﻿using System.Data.Entity;
using StoreDemo.Domain.Entities;

namespace StoreDemo.Data.Repository
{
    internal class StoreDemoDatabaseContext : DbContext
    {
        private readonly IDatabaseInitializer<StoreDemoDatabaseContext> _databaseInitializer;

        public StoreDemoDatabaseContext(IDatabaseInitializer<StoreDemoDatabaseContext> databaseInitializer)
        {
            _databaseInitializer = databaseInitializer;
        }

        public IDbSet<Product> Product { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            Database.SetInitializer(_databaseInitializer);
        }
    }
}